package com.kb.erp.controller;

import com.kb.erp.service.DYYService;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 道一云
 * @author cxhello
 * @create 2021/2/6
 */
@RequestMapping("/dyy")
@RestController
public class DDYXxlJobController {

    private static Logger logger = LoggerFactory.getLogger(DDYXxlJobController.class);

    @Value("${server.port}")
    private int port;
    @Autowired
    private DYYService dyyService;



    /**
     *  道义云token
     */
    @XxlJob("updateDYYToken")
    @GetMapping("/updateDYYToken")
    public void updateDYYToken() {
        dyyService.updateDYYToken();
    }
    /**
     *  道义云token
     */
    @XxlJob("getDYYToken")
    @GetMapping("/getDYYToken")
    public String getDYYToken() {
       return dyyService.getDYYToken();
    }
    /**
     *  道义云token
     */
    @GetMapping("/delKey")
    public void delKey() {
        dyyService.delKey();
    }

    /**
     *
     */
    @GetMapping("/test")
    public void test() {
        logger.info("============12222222222");
        logger.error("================这是一个错误");
        int i = 1/0;
        dyyService.delKey();
    }
}
